//
//  OneKindCell.m
//  1243
//
//  Created by apple on 16/7/1.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "OneKindCell.h"
#import "SucceedView.h"
#import "CZCountDownView.h"
@implementation OneKindCell
//height 300
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.mainPic = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 180)];
//        self.mainPic.backgroundColor = [UIColor blackColor];
        
        
        self.titleLB = [[UILabel alloc]initWithFrame:CGRectMake(10, 180, WIDTH - 20, 30)];
        
        self.peopleCountLB = [[UILabel alloc]initWithFrame:CGRectMake(10, 210, 200, 30)];
        self.peopleCountLB.textColor = [UIColor blueColor];
        
        self.qiLB = [[UILabel alloc]initWithFrame:CGRectMake(10, 240, 100, 25)];
        
        self.restCountLB = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH - 110, 240, 100, 25)];
        self.restCountLB.textAlignment = NSTextAlignmentRight;
        
        self.progressView = [[PeopleCountProgressView alloc]initWithFrame:CGRectMake(0, 270, WIDTH, 10)];
        [self.progressView changePercent:40 Max:100];
        
        
        [self.contentView addSubview:self.mainPic];
        [self.contentView addSubview:self.titleLB];
        [self.contentView addSubview:self.peopleCountLB];
        [self.contentView addSubview:self.qiLB];
        [self.contentView addSubview:self.restCountLB];
        [self.contentView addSubview:self.progressView];
        
    }
    return self;
}

- (void)passAititude:(NSInteger )num {
    if (num == 0) {
        self.alertLB = [[UILabel alloc]initWithFrame:CGRectMake(0, 285, WIDTH, 30)];
        self.alertLB.text = @"您未参与本期抢宝活动";
        self.alertLB.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.alertLB];
    }else if (num == 1) {
        SucceedView *succView = [[SucceedView alloc]initWithFrame:CGRectMake(15, 295, WIDTH - 30, 100)];
        
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 405, WIDTH, 25)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"本期您参与了XX人次";
        [self.contentView addSubview:succView];
        [self.contentView addSubview:label];
    }else if (num == 2) {
        UILabel *alertLB = [[UILabel alloc]initWithFrame:CGRectMake(15, 295, WIDTH - 30, 20)];
        alertLB.textAlignment = NSTextAlignmentCenter;
        alertLB.text = @"本期参与人次已满,等待揭晓:";
        
        CZCountDownView *countDown = [CZCountDownView countDown];
        countDown.frame = CGRectMake(80, 330, WIDTH - 160, 60);
        countDown.timestamp = 5;
        //    countDown.backgroundImageName = @"search_k";
        countDown.timerStopBlock = ^{
            NSLog(@"时间停止");
        };
        
        UILabel *resultLB = [[UILabel alloc]initWithFrame:CGRectMake(15, 415, WIDTH - 30, 20)];
        resultLB.textAlignment = NSTextAlignmentCenter;
        resultLB.text = @"本期夺宝您参与了XX人次";

        
        [self.contentView addSubview:countDown];
        [self.contentView addSubview:alertLB];
        [self.contentView addSubview:resultLB];
                
    }
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
